package cloudnative.demo.labclient.client;

import cloudnative.demo.labclient.model.Device;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.ArrayList;
import java.util.List;

@FeignClient(name="lab-service")
public interface DeviceServiceClient {
    // 查询可用设备
    @GetMapping("/device/queryA")
    List<Device> queryAvailableDevices();

    // 查询公共设备
    @GetMapping("/device/queryP")
    List<Device> queryPublicDevices();

    // 查询所有设备
    @GetMapping("/device/queryAll")
    List<Device> queryAllDevices();

    // 根据WorkerID、LaboratoryID查询设备
    @PostMapping("/device/queryM")
    List<Device> queryDevicesByWorkerOrLab(@RequestBody Device device);

    // 添加设备
    @PostMapping("/device/addD")
    void addDevice(@RequestBody Device device);

    // 删除设备
    @PostMapping("/device/deleteD")
    void deleteDevice(@RequestBody Device device);

    // 更新设备信息
    @PostMapping("/device/alterD")
    void updateDevice(@RequestBody Device device);

}
